package com.qmx.qmxapp.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.qmx.qmxapp.R;
import com.qmx.qmxapp.base.BaseApplication;
import com.qmx.qmxapp.bean.ClickEntity;

import java.util.List;

import de.hdodenhof.circleimageview.CircleImageView;

/**
 *
 */
public class ItemClickAdapter extends BaseMultiItemQuickAdapter<ClickEntity, BaseViewHolder> {

    public ItemClickAdapter(List<ClickEntity> data) {
        super(data);
        addItemType(ClickEntity.CLICK_ITEM_VIEW, R.layout.item_click_view);


    }


    @Override
    protected void convert(final BaseViewHolder helper, final ClickEntity item) {
        switch (helper.getItemViewType()) {
            case ClickEntity.CLICK_ITEM_VIEW:
                helper.addOnClickListener(R.id.iv_status);
                helper.addOnClickListener(R.id.btn);
                helper.setImageResource(R.id.iv_status, R.drawable.icon_group_discuss);
                CircleImageView imageView = helper.getView(R.id.imageView);
                Glide.with(BaseApplication.getInstance().getApplicationContext()).load(item.avatar)
                        //                        .error(R.drawable.beauty)
                        .into(imageView);
                helper.setText(R.id.tv_name, item.name);
                break;
        }
    }

}
